package com.example.demo.service.goods.dto;

import com.example.demo.entity.goods.GoodsInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class GoodsInfoDto {
    private Long id;
    private Long code;
    private String name;
    private String description;
    private String price;
    private String weight;
    private String material;

    public GoodsInfo dtoToEntity() {
        GoodsInfo goodsInfo = new GoodsInfo();
        goodsInfo.setId(this.id);
        goodsInfo.setCode(this.code);
        goodsInfo.setName(this.name);
        goodsInfo.setDescription(this.description);
        goodsInfo.setPrice(this.price);
        goodsInfo.setWeight(this.weight);
        goodsInfo.setMaterial(this.material);
        return goodsInfo;
    }
}

